package com.clkj.goldpartner.service;

import com.clkj.goldpartner.pojo.*;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * @author 杨行
 * @date 2021/3/2 15:33
 */
public interface StockService {

    /**
     * 添加出库单
     *
     * @param outStock
     */
    void addOutStock(OutStock outStock);

    /**
     * 修改出库单
     *
     * @param outStock
     */
    void editOutStock(OutStock outStock);

    /**
     * 添加订单详情
     *
     * @param stockInfo
     */
    void addStockInfo(StockInfo stockInfo);

    /**
     * 获取最后一位编号
     *
     * @return String
     */
    String getOut_num();

    /**
     * 获取不同状态的出货单
     *
     * @param shop_id
     * @param out_status
     * @return List<OutStock>
     */
    List<OutStock> getOutStock(Integer shop_id, String out_status);

    /**
     * 获取指定的库存记录
     *
     * @param stock_status
     * @param stock_num
     * @return
     */
    List<Map> getStockInfo(String stock_status, String stock_num);

    /**
     * 添加进货单
     *
     * @param inStock
     */
    void addInStock(InStock inStock);

    /**
     * 添加确认单
     *
     * @param checkStock
     */
    void addCheckStock(CheckStock checkStock);

    /**
     * 添加质检单
     *
     * @param qualityStock
     */
    void addQualityStock(QualityStock qualityStock);

    /**
     * 添加复核单
     *
     * @param reviewStock
     */
    void addReviewStock(ReviewStock reviewStock);

    /**
     * 获取未完成订单
     *
     * @param shop_id
     * @param supplier_id
     * @param status
     * @return
     */
    List<Map> getInStock(Integer shop_id, Integer supplier_id, String status);

    /**
     * 更新进货订单状态
     *
     * @param in_num
     * @param in_status
     */
    void updateInStock(String in_num, String in_status);

    /**
     * 获取最后一位编号
     *
     * @return String
     */
    String getIn_num();

    /**
     * 获取仓库列表
     *
     * @param shop_id
     * @param warehouse_id
     * @param in_price
     * @param category_id
     * @return
     */
    List<Map> getGoodsStock(Integer shop_id, Integer warehouse_id, Double in_price, Integer category_id);

    /**
     * 添加/修改商品库存
     *
     * @param shop_id
     * @param goods_id
     * @param goods_number
     * @param note
     * @param batch_number
     * @param production_date
     * @param expiration
     * @param warehouse_id
     * @param in_price
     */
    void addGoodsStock(Integer shop_id, Integer goods_id, Integer goods_number, String note, String batch_number, String production_date, String expiration, Integer warehouse_id, Double in_price);

    /**
     * 通过id获取库存列表
     *
     * @param ids
     * @return List<GoodsStock>
     */
    List<GoodsStock> getGoodsStockById(@Param("ids") String ids);

    /**
     * 修改库存
     *
     * @param goodsStock
     */
    void editGoodsStock(GoodsStock goodsStock);

    /**
     * 添加调拨
     *
     * @param wareChange
     */
    void addWareChange(WareChange wareChange);

    /**
     * 货品进货明细
     *
     * @param shop_id
     * @param goods_id
     * @param start_time
     * @param end_time
     * @return
     */
    List<Map<String, Object>> listGoodsInDetail(Integer shop_id, Integer goods_id, String start_time, String end_time);

    /**
     * 供应商供货明细
     *
     * @param shop_id
     * @param supplier
     * @param start_time
     * @param end_time
     * @return
     */
    List<Map<String, Object>> listGyDetail(Integer shop_id, Integer supplier, String start_time, String end_time);

    /**
     * 货品销售明细
     *
     * @param shop_id
     * @param goods_id
     * @param start_time
     * @param end_time
     * @param flag       flag--0货品销售明细,flag--1业务员销售明细，flag--2客户销售明细
     * @return
     */
    List<Map<String, Object>> listGoodsSaleDetail(Integer shop_id, Integer goods_id, String start_time, String end_time, String flag);

    /**
     * 商品库存详情
     *
     * @param shop_id
     * @param goods_id
     * @param warehouse_id
     * @param goods_num
     * @param category_id
     * @param flag
     * @return
     */
    List<Map<String, Object>> listStockDetail(Integer shop_id, Integer goods_id, Integer warehouse_id, String goods_num, Integer category_id, Integer flag);

    /**
     * 库存数量汇总
     *
     * @param shop_id
     * @param warehouse_id
     * @return
     */
    List<Map<String, Object>> stockTotalList(Integer shop_id, Integer warehouse_id);

    /**
     * 库存不足预警
     *
     * @param shop_id
     * @param warehouse_id
     * @return
     */
    List<Map<String, Object>> listStockWarning(Integer shop_id, Integer warehouse_id);

    /**
     * 更新入库仓库id
     *
     * @param stock_num
     * @param warehouse_id
     */
    void updateStockInfoWarehouse(String stock_num, Integer warehouse_id);

    /**
     * 获取到期商品库存
     *
     * @param shop_id
     * @return
     */
    List<Map> getGoodsStockWarn(Integer shop_id);
}
